package org.acompanhamento.dao;

import java.util.List;

import org.acompanhamento.domain.Team;
import org.acompanhamento.domain.Workflow;
import org.hibernate.Criteria;
import org.hibernate.criterion.MatchMode;

import bancosys.tec.persist.dao.BaseDAO;
import bancosys.tec.persist.hibernate.RestrictionsUtils;

public class WorkflowDAO extends BaseDAO<Workflow> {

	public List<Workflow> findByLikeNameTeam(String name, Team team){
		Criteria criteria = this.createCriteria();
		RestrictionsUtils.addRestrictionEq(criteria, "team", team);
		RestrictionsUtils.addRestrictionILike(criteria, "name", name, MatchMode.ANYWHERE);
		return this.executeQuery(criteria);
	}

	public List<Workflow> findByTeam(Team team){
		Criteria criteria = this.createCriteria();
		RestrictionsUtils.addRestrictionEq(criteria, "team", team);
		return this.executeQuery(criteria);
	}

}
